1
|
|
|
'use strict'; |
2
|
|
|
// Node search polyfill for mobile browsers and IE |
3
|
|
|
if (!String.prototype.includes) { |
4
|
|
|
String.prototype.includes = function () { |
5
|
|
|
return String.prototype.indexOf.apply(this, arguments) !== -1; |
6
|
|
|
}; |
7
|
|
|
} |
8
|
|
|
|
9
|
|
|
if (!String.prototype.startsWith) { |
10
|
|
|
String.prototype.startsWith = function (searchString, position) { |
|
|
|
|
11
|
|
|
position = position || 0; |
12
|
|
|
return this.substr(position, searchString.length) === searchString; |
13
|
|
|
}; |
14
|
|
|
} |
15
|
|
|
if (!String.prototype.repeat) { |
16
|
|
|
String.prototype.repeat = function (count) { |
|
|
|
|
17
|
|
|
'use strict'; |
18
|
|
|
if (this === null) { |
19
|
|
|
throw new TypeError('can\'t convert ' + this + ' to object'); |
20
|
|
|
} |
21
|
|
|
var str = '' + this; |
22
|
|
|
count = +count; |
23
|
|
|
if (count < 0) { |
24
|
|
|
throw new RangeError('repeat count must be non-negative'); |
25
|
|
|
} |
26
|
|
|
if (count === Infinity) { |
27
|
|
|
throw new RangeError('repeat count must be less than infinity'); |
28
|
|
|
} |
29
|
|
|
count = Math.floor(count); |
30
|
|
|
if (str.length === 0 || count === 0) { |
31
|
|
|
return ''; |
32
|
|
|
} |
33
|
|
|
// Ensuring count is a 31-bit integer allows us to heavily optimize the |
34
|
|
|
// main part. But anyway, most current (August 2014) browsers can't handle |
35
|
|
|
// strings 1 << 28 chars or longer, so: |
36
|
|
|
if (str.length * count >= 1 << 28) { |
37
|
|
|
throw new RangeError('repeat count must not overflow maximum string size'); |
38
|
|
|
} |
39
|
|
|
var rpt = ''; |
40
|
|
|
for (; ;) { |
41
|
|
|
if ((count & 1) === 1) { |
42
|
|
|
rpt += str; |
43
|
|
|
} |
44
|
|
|
count >>>= 1; |
45
|
|
|
if (count === 0) { |
46
|
|
|
break; |
47
|
|
|
} |
48
|
|
|
str += str; |
49
|
|
|
} |
50
|
|
|
// Could we try: |
51
|
|
|
// return Array(count + 1).join(this); |
52
|
|
|
return rpt; |
53
|
|
|
}; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
require.config({ |
57
|
|
|
baseUrl: 'lib', |
58
|
|
|
paths: { |
59
|
|
|
'polyglot': '../node_modules/node-polyglot/build/polyglot', |
60
|
|
|
'leaflet': '../node_modules/leaflet/dist/leaflet', |
61
|
|
|
'leaflet.label': '../node_modules/leaflet-label/dist/leaflet.label', |
62
|
|
|
'moment': '../node_modules/moment/moment', |
63
|
|
|
// d3 modules indirect dependencies |
64
|
|
|
// by d3-zoom: d3-drag |
65
|
|
|
'd3-ease': '../node_modules/d3-ease/build/d3-ease', |
66
|
|
|
'd3-transition': '../node_modules/d3-transition/build/d3-transition', |
67
|
|
|
'd3-color': '../node_modules/d3-color/build/d3-color', |
68
|
|
|
'd3-interpolate': '../node_modules/d3-interpolate/build/d3-interpolate', |
69
|
|
|
// by d3-force |
70
|
|
|
'd3-collection': '../node_modules/d3-collection/build/d3-collection', |
71
|
|
|
'd3-dispatch': '../node_modules/d3-dispatch/build/d3-dispatch', |
72
|
|
|
'd3-quadtree': '../node_modules/d3-quadtree/build/d3-quadtree', |
73
|
|
|
'd3-timer': '../node_modules/d3-timer/build/d3-timer', |
74
|
|
|
// by d3-drag: d3-selection |
75
|
|
|
// d3 modules dependencies |
76
|
|
|
'd3-selection': '../node_modules/d3-selection/build/d3-selection', |
77
|
|
|
'd3-force': '../node_modules/d3-force/build/d3-force', |
78
|
|
|
'd3-zoom': '../node_modules/d3-zoom/build/d3-zoom', |
79
|
|
|
'd3-drag': '../node_modules/d3-drag/build/d3-drag', |
80
|
|
|
'virtual-dom': '../node_modules/virtual-dom/dist/virtual-dom', |
81
|
|
|
'rbush': '../node_modules/rbush/rbush', |
82
|
|
|
'helper': 'utils/helper', |
83
|
|
|
'language': 'utils/language' |
84
|
|
|
}, |
85
|
|
|
shim: { |
86
|
|
|
'leaflet.label': ['leaflet'], |
87
|
|
|
'd3-drag': ['d3-selection'], |
88
|
|
|
'd3-force': ['d3-collection', 'd3-dispatch', 'd3-quadtree', 'd3-timer'], |
89
|
|
|
'd3-interpolate': ['d3-color'], |
90
|
|
|
'd3-zoom': ['d3-drag', 'd3-ease', 'd3-transition', 'd3-interpolate'] |
91
|
|
|
} |
92
|
|
|
}); |
93
|
|
|
|
94
|
|
|
require(['main'], function (main) { |
95
|
|
|
main(jsonData); |
96
|
|
|
}); |
97
|
|
|
|